package dao

import(
	
)

func GetAllStudent() (error, []models.Student, int64) {
	var studentData []models.Student
	var total int64
	err := db.Table("student").Order("sno ASC").Find(&studentData).Error
	return err, studentData, total
}

func DelStudent(sno int) error {
	err := db.Table("student").Where("student.Sno = ?", student.Sno).Delete(models.Student{}).Error
	return err
}

func UpdateStudent(student models.Student) error {
	err := db.Table("student").Where("sno = ?", student.Sno).Updates(&student).Error
	return err
}

func AddStudent(student models.Student) error {
	err := db.Table("student").Create(&student).Error
	return err
}